package com.jingtai.platform.controller.supply;

import com.jingtai.core.entity.BaseEntity;
import com.jingtai.core.entity.supply.SupplyGoodsRule;
import com.jingtai.platform.service.supply.SupplyGoodsRuleService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 供应商售卖规则表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:32
 */
@Validated
@RestController
@RequestMapping("/platform/supplygoodsrule")
@Api(tags = "供应商售卖规则表")
public class SupplyGoodsRuleController{

    @Autowired
    private SupplyGoodsRuleService supplyGoodsRuleService;


    @ApiOperation("供应商售卖规则表列表查询")
    @GetMapping("/list")
    public ResultUtil aopSupplyGoodsRuleList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return supplyGoodsRuleService.SupplyGoodsRulelist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询supplyGoodsRule实体")
    @GetMapping("/getSupplyGoodsRuleById")
    public ResultUtil GetSupplyGoodsRuleById(@CApiParam(name = "id",value = "supplyGoodsRule实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return supplyGoodsRuleService.getSupplyGoodsRuleById(id);
    }


    @ApiOperation("新增supplyGoodsRule实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"supplyGoodsRule.id","supplyGoodsRule.createTime","supplyGoodsRule.updateTime","supplyGoodsRule.deleteFlag"})
    public ResultUtil aopAddSupplyGoodsRule(@RequestBody @Validated({BaseEntity.Create.class}) SupplyGoodsRule supplyGoodsRule){
        return supplyGoodsRuleService.addSupplyGoodsRule(supplyGoodsRule);
    }

    @ApiOperation("编辑supplyGoodsRule实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"supplyGoodsRule.createTime","supplyGoodsRule.updateTime","supplyGoodsRule.deleteFlag"})
    public ResultUtil aopEditSupplyGoodsRule(@RequestBody @Validated({BaseEntity.Update.class}) SupplyGoodsRule supplyGoodsRule){
        return supplyGoodsRuleService.editSupplyGoodsRule(supplyGoodsRule);
    }

    @ApiOperation("根据ID删除supplyGoodsRule实体")
    @GetMapping("/delSupplyGoodsRuleById")
    public ResultUtil aopDelSupplyGoodsRuleById(@CApiParam(name = "id",value = "supplyGoodsRule实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return supplyGoodsRuleService.delSupplyGoodsRuleById(id);
    }

}






